{php include wl_template('common/header');}
<ul class="nav nav-tabs">
	<li class="active"><a href="">结算记录</a></li>
</ul>
<div class="app-content">
	<div class="app-filter">
		<div class="filter-list">
			<form action="" method="get" class="form-horizontal form" id="form1">
				<input type="hidden" name="c" value="site" />
	            <input type="hidden" name="a" value="entry" />
	            <input type="hidden" name="m" value="{MODULE_NAME}" />
				<input type="hidden" name="p" value="{$_W['plugin']}" />
				<input type="hidden" name="ac" value="{$_W['controller']}" />
				<input type="hidden" name="do" value="{$_W['method']}" />
				<input type="hidden" name="type" value="{$type}"/>
				<input type="hidden" name="days" id="days" value="{$days}"/>
				<input type="hidden" name="trade_type" value="{$trade_type}"/>
				<div class="form-group max-with-all">
					<label class="col-sm-2 control-label">类型</label>
					<div class="col-sm-9">
						<div class="btn-group">
							<a href="{php echo wl_filter_url('trade_type:0');}" class="btn {if $trade_type == 0}btn-primary{else}btn-default{/if}">全部</a>
							{if p('rush')}
							<a href="{php echo wl_filter_url('trade_type:1');}" class="btn {if $trade_type == 1}btn-primary{else}btn-default{/if}">抢购</a>
							{/if}
							{if p('citydelivery')}
							<a href="{php echo wl_filter_url('trade_type:140');}" class="btn {if $trade_type == 140}btn-primary{else}btn-default{/if}">同城配送</a>
							{/if}
							{if p('wlfightgroup')}
							<a href="{php echo wl_filter_url('trade_type:2');}" class="btn {if $trade_type == 2}btn-primary{else}btn-default{/if}">拼团</a>
							{/if}
							{if p('wlcoupon')}
							<a href="{php echo wl_filter_url('trade_type:3');}" class="btn {if $trade_type == 3}btn-primary{else}btn-default{/if}">卡券</a>
							{/if}
							{if p('activity')}
							<a href="{php echo wl_filter_url('trade_type:9');}" class="btn {if $trade_type == 9}btn-primary{else}btn-default{/if}">活动</a>
							{/if}
							{if p('groupon')}
							<a href="{php echo wl_filter_url('trade_type:10');}" class="btn {if $trade_type == 10}btn-primary{else}btn-default{/if}">团购</a>
							{/if}
							{if !is_store()}
							{if p('halfcard')}
							<a href="{php echo wl_filter_url('trade_type:4');}" class="btn {if $trade_type == 4}btn-primary{else}btn-default{/if}">一卡通</a>
							{/if}
							{if p('pocket')}
							<a href="{php echo wl_filter_url('trade_type:5');}" class="btn {if $trade_type == 5}btn-primary{else}btn-default{/if}">掌上信息</a>
							{/if}
							<a href="{php echo wl_filter_url('trade_type:6');}" class="btn {if $trade_type == 6}btn-primary{else}btn-default{/if}">付费入驻</a>
							{if p('distribution')}
							<a href="{php echo wl_filter_url('trade_type:8');}" class="btn {if $trade_type == 8}btn-primary{else}btn-default{/if}">{if Customized::init('distributionText') > 0}共享股东{else}分销{/if}申请</a>
							{/if}
							<a href="{php echo wl_filter_url('trade_type:7');}" class="btn {if $trade_type == 7}btn-primary{else}btn-default{/if}">提现申请</a>
							{/if}
							<a href="{php echo wl_filter_url('trade_type:-1');}" class="btn {if $trade_type == -1}btn-primary{else}btn-default{/if}">后台修改</a>
						</div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">结算时间</label>
					<div class="col-sm-9 js-daterange" data-form="#form1">
						<div class="btn-group">
							<a href="{php echo wl_filter_url('days:-2');}" class="btn {if $days == -2}btn-primary{else}btn-default{/if}">不限</a>
							<a href="{php echo wl_filter_url('days:7');}" class="btn {if $days == 7}btn-primary{else}btn-default{/if}">近一周</a>
							<a href="{php echo wl_filter_url('days:30');}" class="btn {if $days == 30}btn-primary{else}btn-default{/if}">近一月</a>
							<a href="{php echo wl_filter_url('days:90');}" class="btn {if $days == 90}btn-primary{else}btn-default{/if}">近三月</a>
							<a href="javascript:;" class="btn js-btn-custom {if $days == -1}btn-primary{else}btn-default{/if}">自定义</a>
						</div>
						<span class="btn-daterange js-btn-daterange {if $days != -1}hide{/if}">
							{php echo tpl_select_time_info('addtime', array('start' => date('Y-m-d H:i',$starttime), 'end' => date('Y-m-d H:i', $endtime)));}
						</span>
					</div>
				</div>
				{if (!is_agent() || $type != 'agent') && !is_store() }
				<div class="form-group">
					<label class="col-sm-2 control-label">其他</label>
					<div class="col-sm-9">
						{if $type == 'store'}
						<select name="objid" class="form-control select2">
							<option value="0" {if !$objid}selected{/if}>所有店铺</option>
							{loop $stores $store}
							<option value="{$store['id']}" {if $objid == $store['id']}selected{/if}>{$store['storename']}</option>
							{/loop}
						</select>
						{else}
						<select name="objid" class="select2 form-control">
							<option value="0">所有代理</option>
							{loop $agents $agent}
							<option value="{$agent['id']}" {if $objid == $agent['id']}selected{/if}>{$agent['agentname']}</option>
							{/loop}
						</select>
						{/if}
					</div>
				</div>
				{/if}
				<div class="form-group">
					<label class="col-sm-2 control-label"></label>
					<div class="col-sm-9">
						{if (!is_agent() || $type != 'agent') && !is_store() }
						<button class="btn btn-primary">搜索</button>
						{/if}
						<button class="btn btn-default" id="output">导出</button>
						<input type="hidden" value="0" name="outflag" id="outflag" />
					</div>
				</div>
			</form>
		</div>
	</div>
	<div class="app-table-list">
		<div class="table-responsive">
			<table class="table table-bordered table-hover">
				<thead>
					<tr>
						<th style="text-align:center;">时间</th>
						{if !is_agent() || $type != 'agent'}
						<th style="text-align:center;">账户名称</th>
						{/if}
						<th style="text-align:center;">类型</th>
						<th style="text-align:center;">收入|支出(元)</th>
						<th style="text-align:center;">账户余额</th>
						<th style="text-align:center;">详情/备注</th>
					</tr>
				</thead>
				<tbody >
				{loop $records $item}
					<tr>
						<!--时间-->
						<td class="goods-info line-feed" style="padding-left: 10px;">
							{php echo date('Y-m-d H:i:s',$item['createtime'])}
						</td>
						{if !is_agent() || $type != 'agent'}
						<td class="text-center" style="height:60px;font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif ;">
							{$item['objname']}
						</td>
						{/if}
						<!--类型-->
						<td class="text-center" style="font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif;">
							<span class="label label-{$item['css']}">{$item['typename']}</span>
						</td>
						<!--代理收入|支出-->
						<td class="text-center" style="font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif;">
							<span style="color:{if $item['fee']>0} green {else} orangered {/if};"> {if $item['fee']>0}+{/if}{$item['fee']}</span><br />
						</td>
						<td class="text-center" style="font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif;">
							{$item['nowmoney']}
						</td>
						<td class="text-center" style="font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif;">
							{if $item['type'] == -1 || $item['type'] == 15}
							备注:{$item['remark']}
							{else if $item['type'] == 7}
							申请提现或驳回申请
							{else if $item['type'] == 14}
							{if is_agent()}
								<a href="{php echo web_url('halfcard/halfcard_web/userhalfcardlist',array('type'=>2,'reid'=>$item['orderid'],'is_jurisdiction'=>1))}" class="btn btn-default btn-sm">查看详情</a>
							{else}
								<a href="{php echo web_url('halfcard/halftype/uselists',array('type'=>2,'reid'=>$item['orderid'],'is_jurisdiction'=>1))}" class="btn btn-default btn-sm">查看详情</a>
							{/if}
							{else}
							<a href="{php echo web_url('order/wlOrder/orderdetail',array('currentid'=>$item['id'],'is_jurisdiction'=>1))}" class="btn btn-default btn-sm">查看详情</a>
							{/if}
						</td>
					</tr>
					{/loop}
				</tbody>
			</table>
		</div>
		<div class="app-table-foot clearfix">
			<div class="pull-left">

			</div>
			<div class="pull-right">
				{$pager}
			</div>
		</div>
	</div>
</div>
<script>
	$("#output").click(function(){
		$('#outflag').val(1);
		$('#form1')[0].submit();
	});
</script>
{php include wl_template('common/footer');}